package com.rongcheng.fluxtest.stores;

import com.rongcheng.fluxtest.actions.Action;
import com.rongcheng.fluxtest.actions.LoginAction;
import com.rongcheng.fluxtest.model.Message;
import com.squareup.otto.Subscribe;

/**
 * Created by FengRongCheng on 2016/6/19 17:27.
 * powered by yanxiu.com
 */
public class LoginStore extends Store {
    private Message loginMessage = new Message();

    public Message getLoginMessage() {
        return loginMessage;
    }

    @Override
    public StoreChangeEvent storeChangeEvent() {
        return new StoreChangeEvent();
    }

    @Override
    public void onAction(Action action) {
        switch (action.getType()) {
            case LoginAction.ACTION_LOGIN:
                loginMessage.setContent((String) action.getData());
                break;
        }
        emitStoreChange();
    }

}
